package com.night.icm.service.base.mapper.comprehensive_test;

import com.night.icm.model.base.comprehensive_test.IdeologicalPointDTO;
import com.night.icm.persistence.base.entity.comprehensive_test.IdeologicalPoint;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

/**
 * IdeologicalPointMapper
 *
 * @author Liao ZhiYong
 * @date 2020/3/10
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface IdeologicalPointMapper {

    /**
     * DTO转实体
     *
     * @param ideologicalPointDTO dto
     * @return 实体
     */
    @Mapping(target = "files", ignore = true)
    IdeologicalPoint toEntity(IdeologicalPointDTO ideologicalPointDTO);

    /**
     * 更新一个已经存在的实体数据
     *
     * @param dto    存在的DTO
     * @param entity 更新后的实体
     */
    @Mapping(target = "files", ignore = true)
    void updateEntity(IdeologicalPointDTO dto, @MappingTarget IdeologicalPoint entity);
}
